import 'package:flutter/material.dart';

class MyButton03 extends StatelessWidget {
  const MyButton03({ Key ? key }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // GestureDetector无可视化展现，但他可识别用户的手势
    // 许多widget使用GestureDetector为其他的widget提供可选的回调，比如IconButtion、RaiseButton、FloatingActionButton都有onPressed()回调
    return GestureDetector(
      onTap: () {
        print('MyButton was tapped');
      },
      child: Container(
        height: 50.0,
        padding: const EdgeInsets.all(8.0),
        margin: const EdgeInsets.symmetric(horizontal: 8.0),
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(5.0),
          color: Colors.lightGreen[500]
        ),
        child: const Center(
          child: Text('Engage')
        ),
      ),
    );
  }
}